// mapState、mapMutations、mapActions、mapGetters
// 用来定义存储数据
const state = {
  // 会员机构的侧面导航栏
  hymenulist: [
    {
      id: 1,
      modname: "机构信息",
      subroutername: "hyjbxx",
      menulist: [
        {
          id: 2,
          modname: "基本信息",
          subroutername: "hyjbxx",
          disabled: false
        },
        {
          id: 3,
          modname: "股东信息",
          subroutername: "hygdxx",
          disabled: true,

        },
        {
          id: 4,
          modname: "人员信息",
          subroutername: "hyryxx",
          disabled: true,
          list: ['hyryxxxq_1']
        },
        {
          id: 5,
          modname: "其他资质",
          subroutername: "hyqtzz",
          disabled: true
        }
      ]
    },
    {
      id: 6,
      modname: "缴纳会费",
      subroutername: "hyjnhf",
      menulist: [
        {
          id: 7,
          modname: "缴纳会费",
          subroutername: "hyjnhf",
          disabled: false,
          list: ['hyjnhfxq_1', 'hyjnhfxq_2', 'hyjnhfxq_3']
        },
      ]
    },
    {
      id: 6,
      modname: "资信评级",
      subroutername: "hyzxpj",
      menulist: [
        {
          id: 7,
          modname: "资信评级",
          subroutername: "hyzxpj",
          disabled: false
        },
        {
          id: 8,
          modname: "评级记录",
          subroutername: "hypjjl",
          disabled: false
        },
      ]
    },
    {
      id: 9,
      modname: "会议报名",
      subroutername: "hyhybm",
      menulist: [
        {
          id: 10,
          modname: "会议报名",
          subroutername: "hyhybm",
          disabled: false,
          list: ['hyhybmxq_1', 'hyhybmxq_2']
        },
        {
          id: 11,
          modname: "报名记录",
          subroutername: "hybmjl",
          disabled: false,
          list: ['hybmjlxq_1']
        },
      ]
    },
    {
      id: 12,
      modname: "问卷调查",
      subroutername: "hywjdc",
      menulist: [
        {
          id: 13,
          modname: "问卷调查",
          subroutername: "hywjdc",
          disabled: false,
          list: ['hywjdcxq_1']

        },
        {
          id: 14,
          modname: "问卷调查记录",
          subroutername: "hydcjl",
          disabled: false,
          list: ['hydcjlxq_1']
        },
      ]
    },
    {
      id: 15,
      modname: "报告自测",
      subroutername: "hybgzc",
      menulist: [
        {
          id: 16,
          modname: "报告自测",
          subroutername: "hybgzc",
          disabled: false
        },
      ]
    },
    {
      id: 17,
      modname: "站内通知",
      subroutername: "hyzntz",
      menulist: [
        {
          id: 18,
          modname: "站内通知",
          subroutername: "hyzntz",
          disabled: false,
          list: ['hyzntzxq']
        },
      ]
    },
    {
      id: 19,
      modname: "账号信息",
      subroutername: "hyzhxx",
      menulist: [
        {
          id: 20,
          modname: "账号信息",
          subroutername: "hyzhxx",
          disabled: false
        },
      ]
    },
  ],
  // 个人会员的导航栏
  grmenulist: [
    {
      id: 1,
      modname: "账号信息",
      subroutername: "grzhxx",
      menulist: [
        {
          id: 2,
          modname: "账号信息",
          subroutername: "grzhxx",
          disabled: false,
        },
        {
          id: 3,
          modname: "基本信息",
          subroutername: "grjbxx",
          disabled: false,
        },
      ],
    },
    {
      id: 4,
      modname: "缴纳会费",
      subroutername: "grjnhf",
      menulist: [
        {
          id: 5,
          modname: "缴纳会费",
          subroutername: "grjnhf",
          disabled: false,
          list: ['grjnhf_xq1', 'grjnhf_xq2']
        },
      ],
    },
    {
      id: 6,
      modname: "网络教育",
      subroutername: "grwljy",
      menulist: [
        {
          id: 7,
          modname: "课程列表",
          subroutername: "grkclb",
          disabled: false,
        },
        {
          id: 8,
          modname: "我的课程",
          subroutername: "grwdkc",
          disabled: false,
          list: ["spbf"],
        },
        {
          id: 9,
          modname: "学时证明",
          subroutername: "grxszm",
          disabled: false,
        },
      ],
    },
    {
      id: 10,
      modname: "常用功能",
      subroutername: "grcygn",
      menulist: [
        {
          id: 12,
          modname: "会议报名",
          subroutername: "grhybm",
          disabled: false,
          list: ["grhybmxq_1", "grhybmxq_2"],
        },
        {
          id: 13,
          modname: "会议记录",
          subroutername: "grhyjl",
          disabled: false,
          list: ["grbmjlxq_1"],

        },
        {
          id: 13,
          modname: "问卷调查",
          subroutername: "grwjdc",
          disabled: false,
          list: ["grwjdcxq_1"]
        },
        {
          id: 14,
          modname: "历史问卷",
          subroutername: "grwjdcjl",
          disabled: false,
          list: ["grwjdcjlxq_1"]

        },
      ],
    },

    {
      id: 15,
      modname: "站内通知",
      subroutername: "grzntz",
      menulist: [
        {
          id: 16,
          modname: "站内通知",
          subroutername: "grzntz",
          disabled: false,
          list: ["grzntzxq_1"]
        },
      ],
    },
    {
      id: 16,
      modname: "报告自测",
      subroutername: "grbgzc",
      menulist: [
        {
          id: 17,
          modname: "报告自测",
          subroutername: "grbgzc",
          disabled: false
        },
      ]
    },
  ],
  // 专家会员的导航栏
  zjmenulist: [
    {
      id: 1,
      modname: "账号信息",
      subroutername: "zjzhxx",
      menulist: [
        {
          id: 2,
          modname: "账号信息",
          subroutername: "zjzhxx",
          disabled: false,
        },
      ],
    },
    {
      id: 3,
      modname: "会议报名",
      subroutername: "zjcygn",
      menulist: [
        {
          id: 4,
          modname: "会议报名",
          subroutername: "zjhybm",
          disabled: false,
          list: ["zjhybmxq_1", "zjhybmxq_2"],
        },
        {
          id: 5,
          modname: "会议记录",
          subroutername: "zjhyjl",
          disabled: false,
          list: ["zjbmjlxq_1"],

        },
      ],
    },

    {
      id: 6,
      modname: "站内通知",
      subroutername: "zjzntz",
      menulist: [
        {
          id: 7,
          modname: "站内通知",
          subroutername: "zjzntz",
          disabled: false,
          list: ["zjzntzxq_1"]
        },
      ],
    },
    {
      id: 8,
      modname: "报告自测",
      subroutername: "zjbgzc",
      menulist: [
        {
          id: 9,
          modname: "报告自测",
          subroutername: "zjbgzc",
          disabled: false
        },
      ]
    },
  ],
  // 机构信息基本信息表单
  FormData: {
    //机构基本信息
    list: [
      {
        value: "1",
        name: "机构全称",
        span: 2,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "法定代表人",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "会员号",
        span: 1,
        disabled: true,
        type: "input",
        isp: "会员号"
      },
      {
        value: "",
        name: "社会统一信用代码",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "工商登记机关",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "不动产登记代理机构证书号",
        isp: "请输入资格证号",
        span: 1,
        disabled: true,
        type: "input",
      },
      {
        value: "",
        name: "土地估价机构备案函号",
        isp: "请输入土地估价机构备案函号",
        span: 1,
        disabled: true,
        type: "input",
      },
      {
        value: "0",
        name: "注册资金(万元)",
        span: 1,
        disabled: false,
        type: "number",
      },
      {
        value: "limit",
        name: "企业类型",
        span: 1,
        disabled: false,
        type: "select",
        isp: "请选择企业类型",
        list: [],
        bt: true
      },
      {
        value: "",
        name: "法定代表人电话",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "成立时间",
        span: 1,
        disabled: false,
        type: "time",
      },
      {
        value: "",
        name: "办公电话",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "营业期限",
        span: 1,
        disabled: false,
        type: "time",
      },
      {
        value: "",
        name: "联系人电话",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "通讯邮箱",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "邮政编码",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "注册地址",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "传真",
        span: 1,
        disabled: false,
        type: "input",
      },
    ],
    //通讯信息
    txlist: [
      {
        value: "",
        name: "联系人姓名",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "联系人电话",
        span: 1,
        disabled: false,
        type: "input",
        // bt: true
      },
      {
        value: "",
        name: "固定电话",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "通讯邮箱",
        span: 1,
        disabled: false,
        type: "input",
        // bt: true
      },
      {
        value: "",
        name: "邮政编码",
        span: 1,
        disabled: false,
        type: "input",
        // bt: true
      },
      {
        value: "",
        name: "通讯地址",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
    ],
    //发票信息
    fplist: [
      {
        value: "",
        name: "机构全称",
        span: 1,
        disabled: false,
        type: "input",
        bt: false
      },
      {
        value: "",
        name: "社会统一信用代码",
        span: 1,
        disabled: true,
        type: "input",
        bt: false
      },
      {
        value: "",
        name: "通讯邮箱",
        span: 1,
        disabled: false,
        type: "input",
        bt: false
      },
      {
        value: "",
        name: "办公电话",
        span: 1,
        disabled: false,
        type: "input",
        bt: false
      },
      {
        value: "",
        name: "账号",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "开户行",
        span: 1,
        disabled: false,
        type: "input",
        bt: true
      },
      {
        value: "",
        name: "通讯地址",
        span: 1,
        disabled: false,
        type: "input",
        // bt: false
      },
    ],
  },
  // 机构信息人员信息
  jgryFormData: {
    //人员信息
    list: [
      {
        value: "",
        name: "姓名",
        span: 1.5,
        disabled: false,
        type: "input",
      },
      {
        value: '',
        name: "性别",
        span: 2,
        disabled: false,
        type: "select",
        list: [
          {
            value: 0,
            name: "女",
          },
          {
            value: 1,
            name: "男",
          },
        ],
      },
      {
        value: "",
        name: "政治面貌",
        span: 2.5,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "民族",
        span: 1.5,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "出生日期",
        span: 2,
        disabled: false,
        type: "time",
      },
      {
        value: "",
        name: "身份证号",
        span: 2.5,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "专业",
        span: 1.5,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "职称",
        span: 2,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "学历",
        span: 2.5,
        disabled: false,
        type: "input",
      },
      // {
      //   value: "",
      //   name: "所在单位",
      //   span: 2,
      //   disabled: false,
      //   type: "input",
      // },
      {
        value: "",
        name: "职务",
        span: 1.5,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "通讯地址",
        span: 4.5,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "邮政编码",
        span: 1.5,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "电话",
        span: 2,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "电子邮箱",
        span: 2.5,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        isp: "请输入资格证号",
        name: "土地估价专业人员资格证号",
        span: 3,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        isp: "请输入资格证号",
        name: "不动产登记代理人（含土地登记代理人）资格证号",
        span: 3,
        disabled: false,
        isp: '请输入资格证号',
        type: "input",
      },
      {
        value: "",
        isp: "请输入资格证号",
        name: "房地产估价专业人员资格证号",
        isp: '请输入资格证号',
        span: 3,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        isp: "请输入资格证号",
        name: "资产评估师资格证号",
        isp: '资格证号',

        span: 3,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        isp: '请输入资格证号',
        name: "矿业权评估师资格证号",
        span: 3,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        isp: '请输入资格证号',
        name: "保险公估人员资格证号",
        span: 3,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        isp: '请输入资格证号',
        name: "房地产经纪人资格证号",
        span: 3,
        disabled: false,
        type: "input",
      },
      // {
      //   value: "",
      //   name: "其他类型证书",
      //   span: 1,
      //   disabled: false,
      //   type: "input",
      //   arr: true,
      // },
      // {
      //   value: "",
      //   name: "其他证书号",
      //   span: 2,
      //   disabled: false,
      //   type: "input",
      //   arr: true,
      // },
    ],

    dwlist: [
      {
        value: "",
        name: "从业简历",
        span: 3,

        disabled: false,
        type: "text",
      },
      {
        value: "",
        name: "获得奖励或研究成果",
        span: 3,

        disabled: false,
        type: "text",
      },
    ],
    uploadlist: [
      {
        value: {
          dialogVisible: false,
          dialogImageUrl: "",
        },
        type: "upload",
        notes1: "上传一寸照片",
        notes:
          "（电子照片须是“近期、免冠、彩照”证件照，0-600k大小,图像清晰，比例合理，不变形。）",
        imglist: [],
        limit: 1,
        disabled: false
      },
      {
        value: {
          dialogVisible: false,
          dialogImageUrl: "",
        },
        type: "upload",
        notes1: "上传签名照",
        notes: "（您在白纸上或资格证复印件下方签自己的名字上传图片）",
        imglist: [],
        limit: 1,
        disabled: false

      },
    ],
    uploadlist_2: [
      {
        value: {
          dialogVisible: false,
          dialogImageUrl: "",
        },
        type: "upload",
        notes1: "上传土地估价专业人员资格证",
        notes: "（0-600k大小, 图像清晰，比例合理，不变形。）",
        imglist: [],
        limit: 1,
        disabled: false

      },
      {
        value: {
          dialogVisible: false,
          dialogImageUrl: "",
        },
        type: "upload",
        notes1: "上传土地 (不动产)登记代理人证书",
        notes: "（0-600k大小, 图像清晰，比例合理，不变形。）",
        imglist: [],
        limit: 1,
        disabled: false

      },
    ],
  },
  contentlist: {},//报告自测后台返回的数据
  selectshow: 0,//选择方法的状态
  enddata: '',//自测等级

  // 个人信息
  grryFormData: {
    //人员信息
    list: [
      {
        value: "",
        name: "姓名",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: '',
        name: "性别",
        span: 1,
        disabled: false,
        type: "select",
        list: [
          {
            value: 0,
            name: "女",
          },
          {
            value: 1,
            name: "男",
          },
        ],
      },
      {
        value: "",
        name: "政治面貌",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "民族",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "出生日期",
        span: 1,
        disabled: false,
        type: "time",
      },
      {
        value: "",
        name: "身份证号",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "专业",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "职称",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "学历",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "所在单位",
        span: 2,
        disabled: true,
        type: "input",
      },
      {
        value: "",
        name: "职务",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "通讯地址",
        span: 2,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "邮政编码",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "电话",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "电子邮箱",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        isp: "请输入资格证号",
        name: "土地估价专业人员资格证号",
        span: 1,
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "不动产登记代理人（含土地登记代理人）",
        span: 3,
        isp: "不动产登记代理人(含土地登记代理人)",
        disabled: false,
        type: "input",
      },
      {
        value: "",
        name: "房地产估价专业人员",
        span: 1,
        disabled: true,
        type: "input",
      },
      {
        value: "",
        name: "资产评估师",
        span: 1,
        disabled: true,
        type: "input",
      },
      {
        value: "",
        name: "矿业权评估师",
        span: 1,
        disabled: true,
        type: "input",
      },
      {
        value: "",
        name: "保险公估人员",
        span: 1,
        disabled: true,
        type: "input",
      },
      {
        value: "",
        name: "房地产经纪人",
        span: 1,
        disabled: true,
        type: "input",
      },

    ],

    dwlist: [
      {
        value: "",
        name: "从业简历",
        span: 3,
        disabled: false,
        type: "text",
      },
      {
        value: "",
        name: "获得奖励或研究成果",
        span: 3,
        disabled: false,
        type: "text",
      },
    ],
    uploadlist: [
      {
        value: {
          dialogVisible: false,
          dialogImageUrl: "",
        },
        type: "upload",
        notes1: "上传一寸照片",
        notes:
          "（电子照片须是近期、免冠、彩照证件照，0-600k大小,图像清晰，比例合理，不变形。）",
        imglist: [],
        limit: 1,
      },
      {
        value: {
          dialogVisible: false,
          dialogImageUrl: "",
        },
        type: "upload",
        notes1: "上传签名照",
        notes: "（您在白纸上或资格证复印件下方签自己的名字上传图片）",
        imglist: [],
        limit: 1,
      },
    ],
    uploadlist_2: [
      {
        value: {
          dialogVisible: false,
          dialogImageUrl: "",
        },
        type: "upload",
        notes1: "上传土地估价专业人员资格证",
        notes: "（0-600k大小, 图像清晰，比例合理，不变形。）",
        imglist: [],
        limit: 1,
      },
      {
        value: {
          dialogVisible: false,
          dialogImageUrl: "",
        },
        type: "upload",
        notes1: "上传土地 (不动产)登记代理人证书",
        notes: "（0-600k大小, 图像清晰，比例合理，不变形。）",
        imglist: [],
        limit: 1,
      },
    ],
  },
}
// 响应组件中的事件 用来封装异步操作
const actions = {

}
// 操作数据 同步操作
const mutations = {
  setjgryFormData(state, value) {
    state.jgryFormData = value
    // console.log(state.jgryFormData,'+++++++++++++', value)
  },
  //报告自测后台返回的数据，修改
  bgcontentlist(state, value) {
    state.contentlist = value
  },
  // 选择方法的状态
  setselectshow(state, value) {
    state.selectshow = value
  },
  setenddata(state, value) {
    state.enddata = value
  },
  // 个人信息

  setgrryFormData(state, value) {
    let userinfo = JSON.parse(localStorage.getItem("info"));

   
    if (userinfo.group_id == 1) {
      value.list[1].disabled = true
      value.list[2].disabled = true
      value.list[4].disabled = true
      value.list[5].disabled = true
      value.list[9].disabled = true
      value.list[17].disabled = true
      value.list[18].disabled = true
      value.list[19].disabled = true
      value.list[20].disabled = true
      value.list[21].disabled = true
    }else{
      
  for (let prop in value) {
    for(let i = 0;i< value[prop].length;i++){
      if(value[prop][i].disabled){
        value[prop][i].disabled = false
      }
    }
   
  }
      
    }
    console.log(userinfo.group_id,value)
    state.grryFormData = value
  },
  sethymenulist(state, value) {
    // console.log(value)
    state.hymenulist[0].menulist[1].disabled = value
    state.hymenulist[0].menulist[2].disabled = value
    state.hymenulist[0].menulist[3].disabled = value
  },
}
// 用来将state数据进行加工
const getters = {

  grmenulist: (state) => {
    let userinfo = JSON.parse(localStorage.getItem("info"));

    const list = state.grmenulist.map(item => {
      // console.log(item, userinfo.group_id)
      if (userinfo.group_id == 1) {
        if (item.id != 4) {
          return item
        }
      } else {
        return item
      }
    });
    const results = list.filter(item => item !== undefined);

    // console.log(list)
    return results;
  },

}

export default { state, actions, mutations, getters };